<template>
  <ModuleCard>
    <template v-slot:header>领导批示</template>
    <dg-row type="flex" v-if="list.length" class="card-list">
      <dg-col v-for="item in list" :key="item.id" width="24%" :height="'168px'" class="card-item">
        <dg-card :header="item.header" :title="item.header" none-border shadow="never">
          <!-- <p class="card-item__opinion" title="...">同意拟办意见</p> -->
          <p class="card-item__content" :title="item.psnr">{{ item.psnr | filterText }}</p>
        </dg-card>
      </dg-col>
    </dg-row>
    <!-- <div v-else class="no-data"><no-record v-else></no-record></div> -->
    <no-record v-else></no-record>
  </ModuleCard>
</template>

<script>
import { leaderCommentFindMy } from '@/api/common';
import ModuleCard from '@/components/layout/module-card';

export default {
  name: 'leader-comment',
  components: {
    ModuleCard
  },
  data() {
    return {
      list: []
    };
  },
  computed: {
    flowId() {
      return this.$route.params.id || this.$route.params.flowId || '';
    }
  },
  methods: {
    fetchList() {
      leaderCommentFindMy(this.flowId)
        .then(res => {
          this.list = res.data;
          this.list.forEach(ele => {
            // 2020年08月24日 戴菲菲同志批示：
            // ele.header = `${filterDate(ele.pssj, 'yyyy年MM月dd日')} ${ele.psrName}同志批示`;
            const time = ele.pssj || '-';
            const name = ele.psrName ? `${ele.psrName}同志批示` : '-';
            ele.header = `${time}  ${name}`;
          });
        })
        .catch(() => {});
    }
  },
  created() {
    this.fetchList();
  },
  mounted() {
  }
};
</script>

<style lang="scss" scoped>
.card-list {
  flex-wrap: wrap;
  // justify-content: space-between;
}
.card-item {
  margin: 0 0.5rem 1rem 0;
  box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.15);
  border-radius: 2px;
  border: solid 1px rgba(217, 217, 217, 1);
  /deep/.el-card__header {
    font-size: 0.875rem;
    font-weight: normal;
    border-bottom: none;
    background-color: #f5f5f5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  &:first-child {
    margin-left: 0;
  }
  &:last-child {
    margin-right: 0;
  }
  &__opinion {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #67c23a;
  }
  &__content {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
}
</style>
